package com.sc.nft.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.entity.DepositWithdrawalRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sc.nft.entity.vo.*;
import com.sc.nft.enums.DepositWithdrawalRecordPayStatusEnum;
import com.sc.nft.enums.DepositWithdrawalRecordStatusEnum;
import com.sc.nft.enums.DepositWithdrawalRecordTypeEnum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;

/**
 * (sc_deposit_withdrawal_record)数据Mapper
 *
 * @author Sun
 * @since 2022-09-07 12:59:49
 * @description 由 Mybatisplus Code Generator 创建
*/
@Mapper
public interface DepositWithdrawalRecordMapper extends BaseMapper<DepositWithdrawalRecord> {

    Page<NoAuditRechargeRecordVO> getNoAuditRechargeRecord(Page page);

    Page<WithdrawOrRechargeRecordVO> withdrawalsOrRechargeRecord(@Param("userId") Long userId,@Param("calendar") String calendar,@Param("withdraw") DepositWithdrawalRecordTypeEnum withdraw, Page page);

    Page<NoRefundRechargeRecordVO> getNoRefundRechargeRecord(Page page);

    Page<RechargeRecordVO> getRechargeRecord(@Param("startTime") Date startTime, @Param("endTime")Date endTime, @Param("orderNo")String orderNo,
                                             @Param("payStatusEnum") DepositWithdrawalRecordPayStatusEnum payStatusEnum, @Param("userTel")String userTel, Page page);


    NoRefundRechargeRecordByIdVO getNoRefundRechargeRecordById(@Param("id") Long id);

    NoAuditRechargeRecordByIdVO getNoAuditRechargeRecordById(@Param("id") Long id);

    Boolean getByUserIdExists(@Param("userId") Long userId);

    /**
     * 累积已充值(不包含当天)
      * @return
     */
    BigDecimal getSumRecharge();

    /**
     * 累积已提现(不包含当天)
     * @return
     */
    BigDecimal getSumWithdraw();

    /**
     * 昨天的累积用户充值金额总和
     * @return
     */
    BigDecimal getToDayRechargeAmount();
    /**
     * 昨天的累积用户充值金额总和
     * @return
     */
    BigDecimal getSumRechargeAmount();

    BigDecimal getToDayRechargeAmountByDay(@Param("day") String day);
}
